
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
  <head>
    <title>专业管理-编辑</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/lib/bootstrap/bootstrap.min.css" media="all">
    <style type="text/css">
      .layui-form-select {
        width: 100% !important;
      }
      
      .layui-input {
        height: 34px !important;
      }
    </style>
  </head>
  <body class="m-3" style="font-size: 0.9rem;">
    <div class="d-flex layui-form flex-column">
      <div class="d-flex mb-4">
        <span style="width: 80px;margin: 0px;" class="d-flex align-items-center">所属学院:</span>
        <select class="col" name="interest" lay-filter="filter">
          <option value=""></option>
          <c:forEach items="${editCollogeList}" var="item">
            <option value="${item.collogeId}" <c:if test="${item.collogeId == editMajor.collogeId}">selected</c:if>>${item.collogeName}</option>
          </c:forEach>
        </select>
      </div>
      <div class="d-flex mb-4">
        <span style="width: 80px;margin: 0px;" class="d-flex align-items-center">专业名称:</span>
        <input id="majorId" type="hidden" class="form-control form-control-sm" value="${editMajor.majorId}"/>
        <input id="collogeId" type="hidden" class="form-control form-control-sm" value="${editMajor.collogeId}"/>
        <input id="majorName" class="form-control form-control-sm" value="${editMajor.majorName}" placeholder="请填写专业名称"/>
      </div>
      <div class="d-flex mb-4">
        <span style="width: 80px;margin: 0px;" class="d-flex align-items-center">专业序号:</span>
        <input id="orderNum" value="${editMajor.orderNum}" class="form-control form-control-sm" placeholder="请填写专业序号"/>
      </div>
    </div>
    <script src="${pageContext.request.contextPath}/lib/jquery-3.4.1/jquery-3.4.1.min.js" charset="utf-8"></script>
    <script src="${pageContext.request.contextPath}/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
    <script src="${pageContext.request.contextPath}/js/lay-config.js" charset="utf-8"></script>
    <script src="${pageContext.request.contextPath}/js/http.js" charset="utf-8"></script>
    <script>
        //加载layui的form模块
        var layer = null;
        layui.use(['form', 'layer'], function () {
            var form = layui.form;
            layer = layui.layer;
            form.on('select(filter)', function (data) {
                //获取选中的下拉数据
                $("#collogeId").val(data.value)
                console.log(data.elem); //得到select原始DOM对象
                console.log(data.value); //得到被选中的值
                console.log(data.othis); //得到美化后的DOM对象
            });
        })

        function addData() {
            //获取学院id
            var collogeId = $("#collogeId").val();
            if (!collogeId) {
                layer.msg('请选择所属学院!')
                return;
            }
            //获取专业名称
            var majorName = $("#majorName").val();
            if (!majorName) {
                layer.msg('请填写专业名称!');
                return;
            }
            //获取专业序号
            var orderNum = $("#orderNum").val();
            if (!orderNum) {
                layer.msg("请填写专业序号!");
                return;
            }
            return {
                majorId:$("#majorId").val(),
                collogeId: collogeId,
                majorName: majorName,
                orderNum: orderNum
            }

        }
    </script>
  </body>
</html>
